package com.acme.task5;

/**
 * This class process input string with rules: 1. skip numbers 2. double '+' and
 * '-' signs 3. leave other symbols
 * 
 * @author Anton Kotov
 */
public class TextModifier {
	/**
	 * This method prints usage string and exits the program
	 */
	private static void printUsage() {
		System.out.format("usage: %s <string>%n", TextModifier.class.getName());
		System.exit(1);
	}

	/**
	 * Main method
	 * 
	 * @param args
	 *            input string (for example: "1q+2w-3e" -> output will be:
	 *            "q++w--e")
	 */
	public static void main(String[] args) {
		if (args.length < 1) {
			printUsage();
		}

		String str = args[0];
		for (int i = 0; i < str.length(); i++) {
			char charAtIndex = str.charAt(i);
			if (Character.isDigit(charAtIndex)) {
				continue;
			}
			if (charAtIndex == '+' || charAtIndex == '-') {
				System.out.print(charAtIndex);
			}
			System.out.print(charAtIndex);
		}
	}
}
